// 用户相关接口
var express = require('express');
const userController = require('../../controllers/admin/userControllers');
var userRouter = express.Router();

const multer  = require('multer')
const upload = multer({ dest: 'public/avatarUploads/' })

// 用户登录接口
userRouter.post('/user/login', userController.login)

// 测试接口
userRouter.get('/user/add', (req,  res, next) => {
    res.send('respond with a resource')
})
// 用户信息更新接口
userRouter.post('/user/upload', upload.single('file'),userController.upload )

// 添加用户接口
userRouter.post('/user/add', upload.single('file'),userController.add )

// 用户列表获取接口
userRouter.get('/user/list', userController.list )

// 用户删除接口
userRouter.delete('/user/delete', userController.delete )

// 用户编辑获取数据接口
userRouter.get('/user/edit/get', userController.editGet )

// 用户编辑提交接口
userRouter.post('/user/edit/sumbit', userController.editSumbit)

// 导出
module.exports = userRouter
